<template>
    <example :template-code="templateString">
        <template #describe>
            <t :id="`${$t('基础示例')}`">{{ $t('基础示例') }}</t>
        </template>
        <div style="width: 300px;color:#666;">
            <sib-item v-model="value" :props="props" @change="change"></sib-item>
        </div>
        <div style="color:#666;">
            <p>v-model 绑定值：{{ value }}</p>
            <p>当前选中的数据：{{ selections }}</p>
        </div>
    </example>
</template>

<script>
import { ref, reactive } from 'vue';

export default {
    setup() {
        const value = ref(null);
        const selections = ref([]);
        const props = reactive({
            type: 'select',
            options: Array(30).fill().map((_, i) => ({ label: `选项${i}`, value: i })),
        });
        const change = ({ data }) => {
            selections.value = data;
        };

        return {
            props,
            value,
            selections,
            change,
            templateString: `<template>
    <sib-item v-model="value" :props="props" @change="change"></sib-item>
    <p>v-model 绑定值：{{ value }}</p>
    <p>当前选中的数据：{{ selections }}</p>
</template>

<script>
import { ref, reactive } from 'vue';

export default {
    setup() {
        const value = ref(null);
        const selections = ref([]);
        const props = reactive({
            type: 'select',
            options: Array(30).fill().map((_, i) => ({ value: i, label: \`选项\${i}\` })),
        });
        const change = ({ data }) => {
            selections.value = data;
        };

        return { props, value, selections, change };
    },
};
<\/script>`,
        };
    },
};
</script>
